package com.dime.mninterface.api.facotry;


import com.dime.mninterface.api.RemoteHealth100Service;
import com.dime.mninterface.api.model.*;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteHealth100FallbackFactory implements FallbackFactory<RemoteHealth100Service> {
    private static final Logger log = LoggerFactory.getLogger(RemoteHealth100FallbackFactory.class);

    @Override
    public RemoteHealth100Service create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteHealth100Service()
        {
            @Override
            public MNResponse<MNCompany> getCompany(OrderRequestBody requestBody)
            {
                return MNResponse.fail("获取SOA Company:" + throwable.getMessage());
            }

            @Override
            public MNResponse<List<MNOrderDetail>> getOrder(OrderRequestBody requestBody) {
                return MNResponse.fail("获取SOA Order:" + throwable.getMessage());
            }

            @Override
            public MNResponse<MNReport> getReport(ReportRequestBody requestBody) {
                return MNResponseBase.fail("获取报告:" + throwable.getMessage());
            }

            @Override
            public MNResponse<List<MNRegist>> getRegist(RegistRequestBody requestBody) {
                return MNResponse.fail("登记:" + throwable.getMessage());
            }

            @Override
            public MNResponseBase postRecheck(RecheckRequestBody requestBody) {
                return MNResponse.fail("复检通知:" + throwable.getMessage());
            }


        };
    }
}
